-
Notifications
You must be signed in to change notification settings - Fork 2
Implement Cluster Scan #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ca014f5 to
05d8fb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements cluster and standalone scan functionality for the Valkey GLIDE client. The changes introduce a consistent ScanAsync API across both client types while adding support for filtering by pattern, type, and count options.
Key Changes:
- Added
ScanAsyncmethods toIGenericCommands(standalone) andIGenericClusterCommands(cluster) interfaces with implementations in respective clients - Introduced
ScanOptionsclass supporting match pattern, count, and type filtering, andClusterScanCursorfor cluster scan state management - Refactored internal
Request.ScanAsyncto useScanOptionsinstead of individual parameters, updating cursor handling fromlongtostring
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Valkey.Glide.UnitTests/CommandTests.cs | Updated unit tests to use new ScanAsync signature with ScanOptions and string cursors |
| tests/Valkey.Glide.IntegrationTests/ScanTests.cs | Added comprehensive integration tests for scan functionality with filtering options |
| sources/Valkey.Glide/abstract_APITypes/ClusterScanCursor.cs | New cursor abstraction for cluster scan operations |
| sources/Valkey.Glide/Internals/Request.GenericCommands.cs | Refactored scan command builder to accept ScanOptions and return string cursors |
| sources/Valkey.Glide/Internals/FFI.methods.cs | Added FFI bindings for cluster scan operations |
| sources/Valkey.Glide/GlideClusterClient.cs | Implemented ScanAsync for cluster client using new cluster scan command |
| sources/Valkey.Glide/GlideClient.cs | Implemented ScanAsync for standalone client and updated KeysAsync to use new scan interface |
| sources/Valkey.Glide/Commands/Options/ScanOptions.cs | New options class for scan configuration |
| sources/Valkey.Glide/Commands/IGenericCommands.cs | Added ScanAsync method signature for standalone client |
| sources/Valkey.Glide/Commands/IGenericClusterCommands.cs | Added ScanAsync method signature for cluster client |
| sources/Valkey.Glide/Commands/Constants/Constants.cs | Added TYPE keyword constant |
| sources/Valkey.Glide/BaseClient.cs | Added ClusterScanCommand implementation and relocated server version fields |
| rust/src/lib.rs | Implemented Rust FFI functions for cluster scan operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
4cb001b to
b48be5e
Compare
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…r_scan_cursor` in `lib.rs`. Signed-off-by: currantw <[email protected]>
…scan_cursor`. Signed-off-by: currantw <[email protected]>
…tion Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…oving variable outside the loop. Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…e to PascalCase), move `ClusterScanCommand` to `GlideClusterClient`. Signed-off-by: currantw <[email protected]>
…ion. Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
b48be5e to
929be26
Compare
Signed-off-by: currantw <[email protected]>
Implement Cluster Scan
Overview
Adds
ScanAsyncmethods to the standalone and cluster clients.Key Changes
ScanAsynctoIGenericClusterCommandsand implemented it inGlideClusterClient, which calls newBaseClient.ClusterScanCommandmethod.ScanAsynctoIGenericCommands(standalone client) and implemented it inGlideClusterClient, which calls the existing Glide SCAN command. Provides consistent scan interface for standalone and cluster clients.ClusterScanCursor, while both standalone and cluster scanning useScanOptions, which supports match pattern, count, and type arguments. Refactor existingRequest.GenericCommands.ScanAsyncandKeysAsyncmethod to useScanOptions.RequestClusterScanFfiandRemoveClusterScanCursorFfimethods to "FFI.methods.rs", as well as Addrequest_cluster_scanandremove_cluster_scan_cursorto "rust/src/lib.rs" that call into the existing core methods (implementation based on equivalent methods here).Testing Coverage
ScanTestsfor both standalone and clusterScanAsyncmethods.CommandTestsfor change to internalRequest.ScanAsyncinterface.Breaking Changes
None.